package com.zpark.user_system.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 修改页面servlet
 */
@WebServlet("/user/update_page.do")
public class UpdatePageServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 获取被修改用户的ID和用户名
        Integer id = Integer.parseInt(request.getParameter("id"));
        String username = request.getParameter("username");

        // 将用户id和用户名绑定到request域对象
        request.setAttribute("id", id);
        request.setAttribute("username", username);

        // 转发到修改页面
        request.getRequestDispatcher("/jsp/update_user.jsp").forward(request, response);
    }
}
